package com.iot08.api.service;

import com.iot08.common.entity.app.ChatGroupMessage;
import com.iot08.common.entity.app.SensitivityFileGroupMessage;
import com.iot08.common.service.base.BaseService;
import com.iot08.common.utils.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author cwj
 * @description
 * @date 2025/7/9 18:18
 **/
@Slf4j
@Service
public class SensitivityFileGroupMessageService extends BaseService<SensitivityFileGroupMessage> {

    /**
     * @description 保存群聊的面擀数据
     * @author cwj
     * @param [groupId, chatGroupMessage]
     * @return void
     * @date @time 2025/7/9 18:22
     **/
    public void saveData(String groupId, ChatGroupMessage chatGroupMessage){
        SensitivityFileGroupMessage sfgm = new SensitivityFileGroupMessage();
        sfgm.setGroupid(groupId);
        sfgm.setSendType(chatGroupMessage.getSendType());
        sfgm.setAvator(chatGroupMessage.getAvator());
        sfgm.setSender(chatGroupMessage.getSender());
        sfgm.setChatReportTime(chatGroupMessage.getChatReportTime());
        sfgm.setIsExceedLimitRecord(chatGroupMessage.getIsExceedLimitRecord());
        sfgm.setMessageType(chatGroupMessage.getMessageType());
        sfgm.setContent(chatGroupMessage.getContent());
        sfgm.setSize(chatGroupMessage.getSize());
        sfgm.setDuration(chatGroupMessage.getDuration());
        sfgm.setExpiryAt(DateUtil.getSystemExpiryAt());
        sfgm.setTimestamp(DateUtil.nowTimestampToDouble());
        this.save(sfgm);
    }
}
